home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / vbpong1a / block.cls < prev    next >
Text File  |  1999-08-08  |  1KB  |  44 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "Block"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Public x As Long, y As Long, strength As Long, vtype As Long
  15. Public bBActive As Boolean
  16.  
  17. Public Sub Create(nx As Long, ny As Long, nstrength As Long, ntype As Long)
  18.     x = nx
  19.     y = ny
  20.     strength = nstrength
  21.     vtype = ntype
  22.     
  23.     bBActive = True
  24. End Sub
  25.  
  26. Public Sub Blit(back As IDirectDrawSurface2)
  27.     Dim nsrcx As Long
  28.  
  29.     nsrcx = strength * 15
  30.     If vtype = 2 Then
  31.         Select Case strength
  32.             Case 0:
  33.                 nsrcx = 45
  34.             Case 1:
  35.                 nsrcx = 60
  36.             Case 2:
  37.                 nsrcx = 75
  38.         End Select
  39.     End If
  40.     
  41.     Blocks.SetSrc 0, nsrcx, 30, nsrcx + 15
  42.     Blocks.Blit x, y, back
  43. End Sub
  44.